<{include file="../public/header.html"}>
<div class="container-fluid">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-toolbar clearfix">
                    <!--<form class="pull-right search-bar" method="get" action="#!" role="form">
                        <div class="input-group">
                            <div class="input-group-btn">
                                <input type="hidden" name="search_field" id="search-field" value="title">
                                <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
                                    标题 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li> <a tabindex="-1" href="javascript:void(0)" data-field="title">标题</a> </li>
                                    <li> <a tabindex="-1" href="javascript:void(0)" data-field="cat_name">栏目</a> </li>
                                </ul>
                            </div>
                            <input type="text" class="form-control" value="" name="keyword" placeholder="请输入名称">
                        </div>
                    </form>-->
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" href="#!"><i class="mdi mdi-plus"></i> 新增</a>
                        <a class="btn btn-success m-r-5" href="#!"><i class="mdi mdi-check"></i> 启用</a>
                        <a class="btn btn-warning m-r-5" href="#!"><i class="mdi mdi-block-helper"></i> 禁用</a>
                        <!--<a class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 删除</a>-->
                    </div>
                </div>
                <div class="card-body">

                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>
                                    <label class="lyear-checkbox checkbox-primary">
                                        <input type="checkbox" id="check-all"><span></span>
                                    </label>
                                </th>
                                <th>角色编号</th>
                                <th>标题</th>

                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <{foreach from=$list item=$item}>
                            <tr>
                                <td>
                                    <label class="lyear-checkbox checkbox-primary">
                                        <input type="checkbox" name="ids[]" value="1"><span></span>
                                    </label>
                                </td>
                                <td><{$item.role_id}></td>
                                <td><{$item.role_name}></td>

                                <td>
                                    <{if $item.role_status==1}><font class="text-success"><{$item.status_name}></font><{/if}>
                                    <{if $item.role_status==2}><font class="text-warning"><{$item.status_name}></font><{/if}>
                                    <{if $item.role_status==-1}><font class="text-danger"><{$item.status_name}></font><{/if}>
                                </td>
                                <td>
                                    <div class="btn-group">
                                        <a class="btn btn-xs btn-default" href="edit" title="用户列表" data-toggle="tooltip"><i class="mdi mdi-account-multiple"></i></a>
                                        <{if $item.role_id != 1}>
                                        <a class="btn btn-xs btn-default" href="edit?id=<{$item.role_id}>" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                                        <a class="btn btn-xs btn-default" href="auth?id=<{$item.role_id}>" title="授权" data-toggle="tooltip"><i class="mdi mdi-account-key"></i></a>
                                        <a class="btn btn-xs btn-default btn-delete" href="javascript:void(0)" title="删除" data-toggle="tooltip" data-id="<{$item.role_id}>"><i class="mdi mdi-window-close"></i></a>
                                        <{/if}>
                                    </div>
                                </td>
                            </tr>
                            <{/foreach}>
                            </tbody>
                        </table>
                    </div>
                    <!--<ul class="pagination">
                        <li class="disabled"><span>«</span></li>
                        <li class="active"><span>1</span></li>
                        <li><a href="#1">2</a></li>
                        <li><a href="#1">3</a></li>
                        <li><a href="#1">4</a></li>
                        <li><a href="#1">5</a></li>
                        <li><a href="#1">6</a></li>
                        <li><a href="#1">7</a></li>
                        <li><a href="#1">8</a></li>
                        <li class="disabled"><span>...</span></li>
                        <li><a href="#!">14452</a></li>
                        <li><a href="#!">14453</a></li>
                        <li><a href="#!">»</a></li>
                    </ul>-->

                </div>
            </div>
        </div>

    </div>

</div>
<!--消息提示-->
<script src="/backend/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="/backend/js/lightyear.js"></script>
<script type="text/javascript">
    $(function(){
        $('.search-bar .dropdown-menu a').click(function() {
            var field = $(this).data('field') || '';
            $('#search-field').val(field);
            $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
        });
        $('.btn-delete').click(function() {
            var id = $(this).data('id');
            $.ajax({
                type:"POST",
                //提交的网址
                url:"/backend/adminrole/del",
                data:{role_id:id},
                //返回数据的格式
                datatype: "json",
                success:function(data){
                    var res = JSON.parse(data);
                    console.log(res);
                    if(res.code == 1){
                        lightyear.notify('操作成功，页面即将自动跳转~', 'success', 2000, 'mdi mdi-emoticon-happy', 'top', 'center');
                        setTimeout(function(){
                            location.href='/backend/adminrole/index';
                        }, 2000)
                    }else{
                        lightyear.notify(res.msg, 'danger', 500);
                    }
                }   ,

            });
        });
    });
</script>
<{include file="../public/footer.html"}>